package com.woniuxy.springparking.controller;

import com.woniuxy.springparking.asepct.SysLog;
import com.woniuxy.springparking.common.RestDto;
import com.woniuxy.springparking.common.RestResult;
import com.woniuxy.springparking.pojo.TPerFeedback;
import com.woniuxy.springparking.service.TPerFeedbackService;
import com.woniuxy.springparking.vo.LogVO;
import com.woniuxy.springparking.vo.TPerFeedbackVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TPFeedbackController {

    @Autowired
    private TPerFeedbackService tPerFeedbackService;

    @GetMapping("/TFSelectByPage.do")
    @ApiOperation(value = "分页查询所有投诉信息",httpMethod = "GET",
            protocols = "HTTP",produces = "application/json",
            response = RestResult.class,notes = "分页查询所有投诉信息")
    public RestResult tfSelectByPage(TPerFeedbackVo tfVo) {
        return tPerFeedbackService.findTFByPage(tfVo);
    }

    @PostMapping("/findUserName.do")
    @ApiOperation(value = "按id数组查询用户姓名",httpMethod = "POST")
    public List<TPerFeedback> findUserName(@RequestParam("ids[]") Integer[] ids){
        return tPerFeedbackService.findUserName(ids);
    }

    @PostMapping("/updateResultAndStatus.do")
    @ApiOperation(value = "按id更新用户投诉信息",httpMethod = "POST",
            protocols = "HTTP",produces = "application/json",
            response = RestDto.class,notes = "按id更新用户投诉信息")
    @SysLog(value1 = "更新",value2 = "更新用户投诉信息")
    public RestDto updateResultAndStatus(String perFeedbackResult, String perFeedbackStatus, Integer perFeedbackId){
        RestDto dto=new RestDto();
        this.tPerFeedbackService.updateResultAndStatus(perFeedbackResult,perFeedbackStatus,perFeedbackId);
        dto.setCode(200);
        dto.setMsg("处理成功");
        return dto;
    }
}
